/*
 *    Copyright (c) 2018-2025, cloud All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: cloud
 */

package com.fuyao.cloud.asset.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fuyao.cloud.asset.util.AssetUtils;
import com.fuyao.cloud.common.core.model.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 采购申请
 *
 * @author 时间的朋友
 * @date 2021-11-22 13:58:37
 */
@Data
@TableName("fy_asset_purchaseapply")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "采购申请")
public class AssetPurchaseapply extends BaseEntity<AssetPurchaseapply> {

    private static final long serialVersionUID = 1L;

	@ApiModelProperty(value="唯一编码（用于关联附件）")
	private String unid;

    /**
     * 采购单位
     */
    @ApiModelProperty(value="采购单位")
    private String purchaseOuname;

    /**
     * 采购单位ID
     */
    @ApiModelProperty(value="采购单位ID")
    private Long purchaseOuid;

    /**
     * 采购全单位名称
     */
    @ApiModelProperty(value="采购全单位名称")
    private String purchaseOufullname;

    /**
     * 单据类型：默认为ALL{ DEVICE:资产类；CONSUMABLES：易耗品；All:混合}
     */
    @ApiModelProperty(value="单据类型：默认为ALL{ DEVICE:资产类；CONSUMABLES：易耗品；All:混合}")
    private String type;

    /**
     * 单号
     */
    @ApiModelProperty(value="单号")
    private String caseid;

    /**
     * 批次号
     */
    @ApiModelProperty(value="批次号")
    private String batchnumber;

    /**
     * 预算ID
     */
    @ApiModelProperty(value="预算ID")
    private Long budgetId;

    /**
     * 预算编号
     */
    @ApiModelProperty(value="预算编号")
    private String budgetNumber;

    /**
     * 预算名称
     */
    @ApiModelProperty(value="预算名称")
    private String budgetName;

    /**
     * 状态：默认为0{0：草稿、1：处理中、2：已审批、4：作废}
     */
    @ApiModelProperty(value="状态：默认为0{0：草稿、1：处理中、2：已审批、4：作废}")
    private String status;

    /**
     * 供应商ID
     */
    @ApiModelProperty(value="供应商ID")
    private Long supplierId;

    /**
     * 供应商名称
     */
    @ApiModelProperty(value="供应商名称")
    private String supplierName;

    /**
     * 收货信息
     */
    @ApiModelProperty(value="收货信息")
    private String receivinfo;

    /**
     * 期望到货时间
     */
    @ApiModelProperty(value="期望到货时间")
    private LocalDateTime arrivalDatetime;

    /**
     * 采购方式01：邀标、02：自采:03：政府采购
     */
    @ApiModelProperty(value="采购方式01：邀标、02：自采:03：政府采购")
    private String method;

    /**
     * 采购金额
     */
    @ApiModelProperty(value="采购金额")
    private BigDecimal amount;

    /**
     * 采购明细
     */
    @ApiModelProperty(value="采购明细")
    private String detailed;

    /**
     * 采购说明
     */
    @ApiModelProperty(value="采购说明")
    private String explains;

    /**
     * 流程实例ID
     */
    @ApiModelProperty(value="流程实例ID")
    private String processInstanceId;

    /**
     * 货币类型默认人民币：人民币：、欧元：欧元、美元：美元、法元：法元
     */
    @ApiModelProperty(value="货币类型默认人民币：人民币：、欧元：欧元、美元：美元、法元：法元")
    private String currencyType;

	@ApiModelProperty(value="物品清单")
	@TableField(exist = false)
    private List<AssetPurchaseapplyList> purchaseapplyList;

	@TableField(exist = false)
	@ApiModelProperty(value="是否关联采购主单")
	private Boolean joinPurchaseorder;

	public String getDetailedEx() {
		return AssetUtils.formatDetailed(this.detailed);
	}

	public String getStatusCn(){
		return AssetUtils.formatStatus(this.status);
	}

}
